package com.hxh.essaysharing.service;

import com.hxh.essaysharing.entity.Articleinfo;
import com.hxh.essaysharing.mapper.ArticleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/7/22 17:59
 */
@Service
public class ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    public int getArtCountByUid(Integer uid) {
        return articleMapper.getArtCountByUid(uid);
    }

    public int getDraftCountByUid(Integer uid) {
        return articleMapper.getDraftCountByUid(uid);
    }

    public List<Articleinfo> getMyList(Integer uid, Integer state, String key) {
        return articleMapper.getMyList(uid, state, key);
    }

    public int del(Integer id, Integer uid) {
        return articleMapper.del(id, uid);
    }

    public Articleinfo getDetail(Integer id) {
        return articleMapper.getDetail(id);
    }

    public int updateRCount(Integer id) {
        return articleMapper.updateRCount(id);
    }

    public int add(Articleinfo articleinfo) {
        return articleMapper.add(articleinfo);
    }

    public int update(Articleinfo articleinfo) {
        return articleMapper.update(articleinfo);
    }

    public Integer getAllReadCountByUid(Integer uid) {
        return articleMapper.getAllReadCountByUid(uid);
    }

    public List<Articleinfo> getListByPage(Integer pSize, Integer offSize, String key) {
        return articleMapper.getListByPage(pSize, offSize, key);
    }

    public int getTotalArticleCount(String key) {
        return articleMapper.getTotalArticleCount(key);
    }
}
